using System;
using System.Drawing;
using GTA;
using NativeUI;

namespace CustomPeds.Menus;

public class PropMenu : Script
{
    public static UIMenu menu = new UIMenu("", TextSetting.prop_Menu, new Point(0, -107));
    private static bool inited;
    private static Random rng = new Random();

    public PropMenu()
    {
        if (!inited)
        {
            Main.pool.Add(menu);
            Build();
            inited = true;
        }
    }

    public static void Open()
    {
        if (!inited) return;
        menu.Visible = true;
        menu.RefreshIndex();
    }

    private static Ped GetTargetPed()
    {
        return DressingScript.Dressing == Main.Member.P2 ? Main.P2.Character : Main.P1.Character;
    }

    private static void Build()
    {
        menu.Clear();
        menu.SetBannerType(new UIResRectangle());
        menu.AddItem(new UIMenuItem(TextSetting.prop_MenuItem_Hats));
        menu.AddItem(new UIMenuItem(TextSetting.prop_MenuItem_Glasses));
        menu.AddItem(new UIMenuItem(TextSetting.prop_MenuItem_Earrings));
        menu.AddItem(new UIMenuItem(TextSetting.prop_MenuItem_WristAccessories1));
        menu.AddItem(new UIMenuItem(TextSetting.prop_MenuItem_WristAccessories2));
        for (int i = 0; i < menu.MenuItems.Count; i++)
        {
            menu.BindMenuToItem(PropSubMenu.menu, menu.MenuItems[i]);
        }
        menu.RefreshIndex();
    }
}


